package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPipeNetworkMonitoringPoints;
import com.ruoyi.system.service.IDispatchPipeNetworkMonitoringPointsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 管网监测点信息Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPipeNetworkMonitoringPoints")
public class DispatchPipeNetworkMonitoringPointsController extends BaseController
{
    @Autowired
    private IDispatchPipeNetworkMonitoringPointsService dispatchPipeNetworkMonitoringPointsService;

    /**
     * 查询管网监测点信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPipeNetworkMonitoringPoints dispatchPipeNetworkMonitoringPoints)
    {
        startPage();
        List<DispatchPipeNetworkMonitoringPoints> list = dispatchPipeNetworkMonitoringPointsService.selectDispatchPipeNetworkMonitoringPointsList(dispatchPipeNetworkMonitoringPoints);
        return getDataTable(list);
    }

    /**
     * 导出管网监测点信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:export')")
    @Log(title = "管网监测点信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPipeNetworkMonitoringPoints dispatchPipeNetworkMonitoringPoints)
    {
        List<DispatchPipeNetworkMonitoringPoints> list = dispatchPipeNetworkMonitoringPointsService.selectDispatchPipeNetworkMonitoringPointsList(dispatchPipeNetworkMonitoringPoints);
        ExcelUtil<DispatchPipeNetworkMonitoringPoints> util = new ExcelUtil<DispatchPipeNetworkMonitoringPoints>(DispatchPipeNetworkMonitoringPoints.class);
        util.exportExcel(response, list, "管网监测点信息数据");
    }

    /**
     * 获取管网监测点信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:query')")
    @GetMapping(value = "/{pipeNetworkMonitoringPointsId}")
    public AjaxResult getInfo(@PathVariable("pipeNetworkMonitoringPointsId") Long pipeNetworkMonitoringPointsId)
    {
        return success(dispatchPipeNetworkMonitoringPointsService.selectDispatchPipeNetworkMonitoringPointsByPipeNetworkMonitoringPointsId(pipeNetworkMonitoringPointsId));
    }

    /**
     * 新增管网监测点信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:add')")
    @Log(title = "管网监测点信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPipeNetworkMonitoringPoints dispatchPipeNetworkMonitoringPoints)
    {
        return toAjax(dispatchPipeNetworkMonitoringPointsService.insertDispatchPipeNetworkMonitoringPoints(dispatchPipeNetworkMonitoringPoints));
    }

    /**
     * 修改管网监测点信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:edit')")
    @Log(title = "管网监测点信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPipeNetworkMonitoringPoints dispatchPipeNetworkMonitoringPoints)
    {
        return toAjax(dispatchPipeNetworkMonitoringPointsService.updateDispatchPipeNetworkMonitoringPoints(dispatchPipeNetworkMonitoringPoints));
    }

    /**
     * 删除管网监测点信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPoints:remove')")
    @Log(title = "管网监测点信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pipeNetworkMonitoringPointsIds}")
    public AjaxResult remove(@PathVariable Long[] pipeNetworkMonitoringPointsIds)
    {
        return toAjax(dispatchPipeNetworkMonitoringPointsService.deleteDispatchPipeNetworkMonitoringPointsByPipeNetworkMonitoringPointsIds(pipeNetworkMonitoringPointsIds));
    }
}
